package com.block.datapush.service.apipush.utils;

import cn.hutool.core.util.StrUtil;
import com.block.common.enums.BaseTypeInfoEnum;
import org.apache.commons.lang3.StringUtils;

import javax.crypto.Cipher;
import java.nio.charset.StandardCharsets;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;

/**
 * 海豚钱包 双授权
 */
public class HaiTunQianBaoSsqUtil {

    //性别
    public static Integer getSex(Integer sex) {
        if (sex == 1) {
            return 1;
        }
        return 2;
    }

    public static String getIpAddress(String ip){
        if (StringUtils.isNotEmpty(ip)){
            return ip;
        }
        return "127.0.0.1";
    }

    //芝麻分
    public static Integer getZhimaScore(String zhima) {
        if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm001.getValue(), zhima) || StrUtil.equals(BaseTypeInfoEnum.Zhima.zm002.getValue(), zhima)) {
            return 41;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm003.getValue(), zhima)) {
            return 42;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm004.getValue(), zhima)) {
            return 43;
        }
        return 45;
    }

    //信用情况
    public static Integer getyuqi(String yuqi) {
        if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq001.getValue(), yuqi)) {
            return 40;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Yuqi.yq002.getValue(), yuqi)){
            return 39;
        }
        return 37;
    }

    //信用情况
    public static Integer getXinyongka(String xyk) {
        if (StrUtil.equals(BaseTypeInfoEnum.XinYongKa.xyk001.getValue(), xyk)) {
            return 22;
        }
        return 21;
    }

    //房产情况
    public static Integer getHouse(String house) {
        if (StrUtil.equals(BaseTypeInfoEnum.House.hu001.getValue(), house)) {
            return 55;
        }else if (StrUtil.equals(BaseTypeInfoEnum.House.hu004.getValue(), house)) {
            return 56;
        }
        return 57;
    }

    //车产情况
    public static Integer getCar(String car) {
        if (StrUtil.equals(BaseTypeInfoEnum.Car.car001.getValue(), car)) {
            return 52;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Car.car002.getValue(), car)) {
            return 54;
        }
        return 53;
    }

    //公积金
    public static Integer getGjj(String gongjijin) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj001.getValue(), gongjijin)) {
            return 36;
        }if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj002.getValue(), gongjijin)) {
            return 35;
        }
        return 34;
    }

    //社保
    public static Integer getSocialInsurance(String shebao) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb001.getValue(), shebao)) {
            return 31;
        }if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb002.getValue(), shebao)) {
            return 30;
        }
        return 29;
    }

    public static Integer gethuabei(String buabei) {
        if (StrUtil.equals(BaseTypeInfoEnum.Huabei.hb001.getValue(), buabei)) {
            return 111;
        }
        return 113;
    }

    public static Integer getjdbaitiao(String jdbaitiao) {
        if (StrUtil.equals(BaseTypeInfoEnum.Baitiao.bt001.getValue(), jdbaitiao)) {
            return 14;
        }
        return 16;
    }

    //贷款额度
    public static Integer getloan(String loan) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la001.getValue(), loan) || StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la002.getValue(), loan)) {
            return 76;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la003.getValue(), loan)) {
            return 75;
        }
        return 74;
    }

    //职业
    public static Integer getjob(String job) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz001.getValue(), job)) {
            return 17;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz002.getValue(), job)) {
            return 20;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz003.getValue(), job)) {
            return 18;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz004.getValue(), job)) {
            return 109;
        }
        return 19;
    }

    public static Integer  getxueli(String xueli) {
        if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl003.getValue(), xueli)) {
            return 88;
        } else if (StrUtil.equals(BaseTypeInfoEnum.XueLi.xl004.getValue(), xueli) || StrUtil.equals(BaseTypeInfoEnum.XueLi.xl005.getValue(), xueli)) {
            return 89;
        }
        return 87;
    }

    //投保情况
    public static Integer getbaodan(String baodan) {
        if (StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx001.getValue(), baodan)) {
            return 95;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx002.getValue(), baodan)) {
            return 96;
        }
        return 97;
    }











































    public static Integer getloantime(String loantime) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt001.getValue(), loantime)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt002.getValue(), loantime)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanTime.lt003.getValue(), loantime)) {
            return 2;
        }
        return 3;

    }

    public static Integer getYongtu(String yongtu) {
        if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt001.getValue(), yongtu)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt004.getValue(), yongtu)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt002.getValue(), yongtu)) {
            return 4;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Yongtu.yt003.getValue(), yongtu)) {
            return 3;
        }
        return 0;
    }
    public static Integer getShouRu(String shouru) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr001.getValue(), shouru)) {
            return 0;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr002.getValue(), shouru)) {
            return 1;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr003.getValue(), shouru)) {
            return 3;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr004.getValue(), shouru)) {
            return 4;
        }
        return 2;
    }



}
